home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2375 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.iag.net!news
  2. From: jatmon@iag.net (John R Buchan)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Please help ?!
  5. Date: 20 Jan 1996 22:25:54 GMT
  6. Organization: Internet Access Group, Orlando, Florida
  7. Message-ID: <4drq5i$cr@news.iag.net>
  8. References: <4dm889$3hs@neptunus.pi.net> <4drnv1$cr@news.iag.net>
  9. NNTP-Posting-Host: pm1-orl30.iag.net
  10. X-Newsreader: WinVN 0.99.7
  11.  
  12. In article <4drnv1$cr@news.iag.net>, jatmon@iag.net says...
  13. >
  14. >In article <4dm889$3hs@neptunus.pi.net>, mv@pi.net says...
  15. >>
  16. >>Hello everybody,
  17. >>
  18. >>
  19. >>Please take a look at this:
  20. ><code snipped>
  21. >
  22. >Below is a modified version of the posted code.  All comments are mine
  23. ><hint about need for comments> and usually refer to modifications I have 
  24. made.
  25. >
  26. <snip>
  27.  
  28. Oops.  I missed a couple of things.
  29.    
  30. >   /* Why malloc? You could just define saved as char saved[MAXLEN]; */
  31. >   /* and set cpy = saved                                            */
  32. >   cpy = (char *) malloc(MAXLEN);
  33.  
  34. The cast is unnecessary and can hide errors.  You should remove it.
  35.  
  36. <snip>
  37. >      /* if (!strchr("/-\0", *cmd)) make this an else. no conditions needed 
  38. */
  39. >      else
  40. >         {
  41. >         *cmd++;
  42.  
  43. I believe you only intend to increment cmd here.  Do not use the dereference
  44. operator.  It serves no purpose.
  45.  
  46.           cmd++;
  47.  
  48.  
  49. -- 
  50. John R Buchan           -:|:-     Looking for that elusive FAQ?  ftp to:
  51. jatmon@mail.iag.net     -:|:-     rtfm.mit.edu /pub/usenet-by-group/....
  52.  
  53.